//
//  ZBFancyTableViewCell.m
//  ZBFancyTableView
//
//  Created by xzb on 2020/1/12.
//

#import "ZBFancyTableViewCell.h"

@interface ZBFancyTableViewCell ()

@property (nonatomic, assign) BOOL initializedView;


@end

@implementation ZBFancyTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return self;
}

- (void)initializeView
{
    if (self.initializedView) {
        return;
    }
    if (self.initializeViewBlock) {
        self.initializeViewBlock(self);
    }
    self.initializedView = YES;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    if (self.layoutSubviewsBlock) {
        self.layoutSubviewsBlock(self);
    }
}

- (void)prepareForReuse
{
    [super prepareForReuse];
    
    if (self.resetViewBlock) {
        self.resetViewBlock(self);
    }
}

#pragma mark - IMXCellProtocol
+ (CGFloat)cellHeight:(id)model
{
    return 0;
}

- (void)loadData:(id)data
{
    [self initializeView];
    
    if (self.updateViewBlock) {
        self.updateViewBlock(self, data);
    }
}

@end
